package com.example.myapplication.ContentTest;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DicitionaryDataHelper extends SQLiteOpenHelper {
  private static final String DataBaseName = "vocabulary.db";
  private String tableName="vocabulary_table";
  private static final int DATABASE_VERSION=1;
  private SQLiteDatabase database;
  public DicitionaryDataHelper(Context context) {
    super(context, DataBaseName, null, DATABASE_VERSION);
    database=this.getWritableDatabase();
  }

  public String getTableName() {
    return tableName;
  }

  public void setTableName(String tableName) {
    this.tableName = tableName;
  }

  @Override public void onCreate(SQLiteDatabase db) {
    String createTableQuery="create table "+tableName+"(word  Text PRIMARY KEY,illustration Text)";
    db.execSQL(createTableQuery);

  }

  @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    //database=this.getWritableDatabase();
    db.execSQL("DROP TABLE IF EXISTS " + tableName);

    onCreate(db);
  }
}
